package me.kagami.exex.intercepter;

import java.util.List;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;

public class IntercepterChain {

	public static <T> void beforeInsertData(List<InsertDataIntercepter> chain, Cell cell, T field, int rowNumber, int colNumber) {
		chain.stream().forEach(c -> {
			c.beforeInsertData(cell, field, rowNumber, colNumber);
		});
	}

	public static <T> void afterInsertData(List<InsertDataIntercepter> chain, Cell cell, T field, int rowNumber, int colNumber) {
		chain.stream().forEach(c -> {
			c.afterInsertData(cell, field, rowNumber, colNumber);
		});
	}

	public static <T> void beforeInsertRow(List<InsertDataIntercepter> chain, Row row, T dataBean, int rowNumber) {
		chain.stream().forEach(c -> {
			c.beforeInsertRow(row, dataBean, rowNumber);
		});
	}

	public static <T> void afterInsertRow(List<InsertDataIntercepter> chain, Row row, T dataBean, int rowNumber) {
		chain.stream().forEach(c -> {
			c.afterInsertRow(row, dataBean, rowNumber);
		});
	}

	public static void beforeAssembleData(List<InsertDataIntercepter> chain, Sheet sheet, List<?> dataList, int beginRowNum, int beginColNum) {
		chain.stream().forEach(c -> {
			c.beforeAssembleData(sheet, dataList, beginRowNum, beginColNum);
		});
	}

	public static void afterAssembleData(List<InsertDataIntercepter> chain, Sheet sheet, List<?> dataList) {
		chain.stream().forEach(c -> {
			c.afterAssembleData(sheet, dataList);
		});
	}

}
